<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>前端h5</title>
</head>
<body>
<h1>标题</h1>
<img class="avatar" src="" alt="">
<button id="btn1">按钮</button>
<button id="btnPhoto">拍照</button>
<button id="btnSelect">选择相册</button>
<script src="./eruda.js"></script>
<script>
    eruda.init();
</script>
<script>
    document.querySelector("#btn1").addEventListener("click", () => {
      // window.zph.showMessage("前端调用鸿蒙");
      // window.abc.showMessage("前端调用鸿蒙");
      const user = zph.getUser();
      zph.showMessage(JSON.stringify(user));
    });
    function changetitle(name) {
      document.querySelector("h1").innerText = name;
    }
    document
      .querySelector("#btnPhoto")
      .addEventListener("click", async () => {
        const url = await zph.takePicture();
        document.querySelector(".avatar").src = url;
      });
    document
      .querySelector("#btnSelect")
      .addEventListener("click", async () => {
        const url = await zph.selectPicture();
        document.querySelector(".avatar").src = url;
      });
</script>
</body>
</html>
